/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.bme.j2ee.v37zen.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author Kiss Dániel
 */
@Entity
@Table(name = "SD_HISTORY")
public class History implements Serializable {
    private static final long serialVersionUID = 2926381703099805522L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private int timesDialed = 0;
    @Temporal(javax.persistence.TemporalType.DATE)
    @Column(nullable = true)
    private Date lastTimeDialed;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date created;

    public History() {
    }

    public History(Date created) {
        this.created = created;
    }    

    /**
     * Get the value of lastTime
     *
     * @return the value of lastTime
     */
    public Date getLastTime() {
        return lastTimeDialed;
    }

    /**
     * Set the value of lastTime
     *
     * @param lastTime new value of lastTime
     */
    public void setLastTime(Date lastTime) {
        this.lastTimeDialed = lastTime;
    }

    
    /**
     * Get the value of timeOfDialed
     *
     * @return the value of timeOfDialed
     */
    public int getTimeOfDialed() {
        return timesDialed;
    }

    /**
     * Set the value of timeOfDialed
     *
     * @param timeOfDialed new value of timeOfDialed
     */
    public void setTimeOfDialed(int timeOfDialed) {
        this.timesDialed = timeOfDialed;
    }
    
     /**
     * Get the value of created
     *
     * @return the value of created
     */
    public Date getCreated() {
        return created;
    }

    /**
     * Set the value of created
     *
     * @param created new value of created
     */
    public void setCreated(Date created) {
        this.created = created;
    }
    

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 89 * hash + this.timesDialed;
        hash = 89 * hash + (this.lastTimeDialed != null ? this.lastTimeDialed.hashCode() : 0);
        hash = 89 * hash + (this.created != null ? this.created.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof History)) {
            return false;
        }
        History other = (History) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "History{" + "id=" + id + ", timesDialed=" + timesDialed + ", lastTimeDialed=" + lastTimeDialed + ", created=" + created + '}';
    }

      
    
}
